package com.unitd.modules.configcenter.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.unitd.comm.entity.DataEntity;

import javax.persistence.Column;
import javax.persistence.Table;
import java.util.Date;

/**
 * @desc 用户信息表表对应实体对象
 * @filename Users.java
 * @copyright www.unitd.com
 * @author Hudan
 * @version 1.0
 * @date  2018-01-30
 */
@Table(name = "users")
public class Users extends DataEntity {

	/** 登录用户名 */
	@Column(name = "name")
	private String name;
	/** 密码 */
	@Column(name = "password")
	private String password;
	/** 手机 */
	@Column(name = "mobile")
	private String mobile;
	/** 邮箱 */
	@Column(name = "email")
	private String email;
	/** 用户类型 */
	@Column(name = "type")
	private Short type;
	/** 用户拥有的权限环境串(多个环境之间用,分割; 比如:dev,test,prep,prod) */
	@Column(name = "gant_envs")
	private String gantEnvs;
	/** 状态 */
	@Column(name = "status")
	private Short status;
	/** 创建时间 */
	@Column(name = "created_at")
	private Date createdAt;
	/** 更新时间 */
	@Column(name = "updated_at")
	private Date updatedAt;
	/* ************************** 与数据库字段不直接关联而是对应外键对象或数据处理的字段 ************************** */

	public Users() {
		super();
	}

	public Users(String id){
		super(id);
	}

	public Users(String id, String name, String password, String mobile, String email, Short type, String gantEnvs, Short status, Date createdAt, Date updatedAt){
		this.id = id;
		this.name = name;
		this.password = password;
		this.mobile = mobile;
		this.email = email;
		this.type = type;
		this.gantEnvs = gantEnvs;
		this.status = status;
		this.createdAt = createdAt;
		this.updatedAt = updatedAt;
	}

	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getMobile() {
		return mobile;
	}
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public Short getType() {
		return type;
	}
	public void setType(Short type) {
		this.type = type;
	}
	public String getGantEnvs() {
		return gantEnvs;
	}
	public void setGantEnvs(String gantEnvs) {
		this.gantEnvs = gantEnvs;
	}
	public Short getStatus() {
		return status;
	}
	public void setStatus(Short status) {
		this.status = status;
	}
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getCreatedAt() {
		return createdAt;
	}
	public void setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
	}
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getUpdatedAt() {
		return updatedAt;
	}
	public void setUpdatedAt(Date updatedAt) {
		this.updatedAt = updatedAt;
	}
}